<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            height: 5000px;
        }
        
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        
        .box1 {
            height: 200px;
            width: 100%;
            background: skyblue;
        }
        
        .box2 {
            height: 200px;
            width: 100%;
            background: red;
        }
        
        .box3 {
            width: 100%;
            height: 50px;
            background-color: orange;
        }
        
        .art {
            position: fixed;
            top: 10px;
        }
        
        .box3 div {
            width: 40%;
            height: 50px;
            background: red;
            margin: 0 auto;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 30px;
        }
        
        .box3 input {
            width: 500px;
            height: 40px;
            border: none;
        }
    </style>
</head>

<body>

    <div class="box2"></div>
    <div class="box1"></div>

    <div class="box3 art">
        <div>
            <input class="box" type="text" placeholder="高级包包">
        </div>
    </div>
    <script>
        // 绑定点击事件
        var art = document.querySelector('.art')
        window.onscroll = function() {
            console.log(1);

            if (scrollY <= 400) {
                art.className = 'box3'
                art.style.top = 0 + 'px'

            } else if (scrollY >= 400) {
                art.className = 'box3 art'
            }
        }
    </script>
</body>

</html>